<?php

namespace app\index\controller;
use app\common\model\log\XcxApiLogs as XcxApiLogsModel;
use app\common\model\jsm\Membersx as MembersxModel;

class Xcx extends \app\common\controller\AuthBase {

    public function __construct() {
        parent::__construct();
    }

 
    /**
     * 访问小程序接口时写入日志表
     */
    public function addApiLog() {
        $params = $this->input();
        $XcxApiLogsModel = new XcxApiLogsModel();
        $res = $XcxApiLogsModel->write_log($params['param'],$params['result'],$params['status'],$params['url'],$params['ip']);
        return $this->output($res);
    }
    
    /**
     * 创建和更新用户
     */
    public function create_edit_user(){
        $param_list = [
            'scene' => 'number'
        ]; 
        $params = $this->input();
        $this->diffParam($param_list, $params);
        $MembersxModel = new MembersxModel($params['mp_id']);
        $rs = $MembersxModel->create_edit_user($params['user_info'], $params['scene']);
        return $this->output($rs);
    }
}
